<?php
namespace app\admin\controller;

use think\annotation\route\Group;
use think\annotation\Route;
use think\annotation\route\Middleware;
use app\admin\middleware\CheckAdmin;
use think\facade\Db;

/**
 * 结论
 * Class Conclusion
 * @package app\admin\controller
 * @Group("Conclusion")
 *
 */
class Conclusion extends Base
{
    /**
     * 结论保存
     * @Route("save", method="POST")
     * @middleware({CheckAdmin::class})
     */
    public function save()
    {
        $id = input('id', '', 'trim');
        $report_id = input('report_id', '', 'trim');
        $submit_time = input('submit_time', '', 'trim');
        $data = [
            'project_record_id' => $id,
            'report_id' => $report_id,
            'submit_time' => strtotime($submit_time),
        ];
        Db::name('conclusion')->insert($data);
        return json_ok([], 10000, '操作成功');
    }

    /**
     * 结论详情
     * @Route("getConclusionById", method="POST")
     * @middleware({CheckAdmin::class})
     */
    public function getConclusionById()
    {
        $id = input('id', '', 'trim');
        $res = Db::name('conclusion')
            ->where('id',$id)
            ->find();
        return json_ok($res);
    }
}